import { http } from "@/utils/http";

export type commonResult<T> = {
  code: number;
  msg: string;
  result: T;
};

export type infoType = {

	id?: number,
	fieldName?: string,
	unit?: string,
	fieldAlias?: string,
	dataType?: number,
	isShow?: number,
  cateGory?: number,
	remark?: string,
}
export type infoTypeList = {
  data: infoType[];
  total: number;
};

const List = '/system/product/product/v2/structures';
const Url = '/system/product/product/v2/structure';
export const getList = (params?: object) => {
  return http.request<commonResult<infoType[]>>("get", List, {
    params
  });
};
export const getInfo = (params?: object) => {
  return http.request<commonResult<infoType>>("get", Url, {
    params
  });
};
export const addInfo = (data?: object) => {
  return http.request<commonResult<any>>("post", Url, {
    data
  });
};
export const editInfo = (data?: object) => {
  return http.request<commonResult<any>>("put", Url, {
    data
  });
};
export const deleteInfo = (data?: object) => {
  return http.request<commonResult<any>>("delete", Url, {
    data
  });
};
